<template>
  <h1>son3子组件</h1>
  {{name}}
  <input type="button" @click="fun" value="点击" />
</template>

<script>
  import { ref, inject } from 'vue'
  export default {
    setup(props, context)
    {
      //接收父组件传递过来的数据
      var name = inject('name')
      var fun = inject('fun')

      return {
        name,
        fun
      }

      console.log(name)
    }
  }
</script>